"use client";

import { Layout, Typography, Card, Space } from "antd";
import SearchBar from "../src/components/SearchBar";
import FilterPanel from "../src/components/FilterPanel";
import SearchResults from "../src/components/SearchResults";
import { useState } from "react";

const { Content } = Layout;
const { Title, Paragraph } = Typography;

interface Filters {
  projectType: string;
  documentType: string;
  dateRange: [string, string] | null;
  projectManager: string;
  projectPhase: string;
  industryType: string;
}

export default function Home() {
  const [searchQuery, setSearchQuery] = useState("");
  const [filters, setFilters] = useState<Filters>({
    projectType: "all",
    documentType: "all",
    dateRange: null,
    projectManager: "all",
    projectPhase: "all",
    industryType: "all",
  });

  const handleFilterChange = (newFilters: Filters) => {
    setFilters(newFilters);
  };

  return (
    <Layout className="min-h-screen bg-white">
      <Content className="p-8">
        <div className="max-w-7xl mx-auto space-y-6">
          <div className="text-center mb-8">
            <Title level={2}>业务数据智能管理分析系统</Title>
            <Paragraph className="text-gray-500">
              快速定位项目文档，支持多维度智能检索
            </Paragraph>
          </div>

          <Card>
            <Space direction="vertical" className="w-full" size="large">
              <SearchBar value={searchQuery} onChange={setSearchQuery} />
              <FilterPanel filters={filters} onChange={handleFilterChange} />
            </Space>
          </Card>

          <Card title="搜索结果" className="shadow-sm">
            <SearchResults searchQuery={searchQuery} filters={filters} />
          </Card>
        </div>
      </Content>
    </Layout>
  );
}
